import request from '@/utils/request'

export function tenant(data) {
  return request({
    url: '/Tenant/Search',
    method: 'POST',
    data
  })
}

export function tenantAddEdit(method, value) {
  let url = ''
  let data = null
  method = method.toLocaleUpperCase()

  if (method === 'PUT') {
    url = '/Tenant/' + value.id
    data = value.value
  } else {
    url = '/Tenant'
    data = value
  }

  return request({
    url,
    method,
    data
  })
}

export function tenantDel(data) {
  return request({
    url: `Tenant/${data.id}`,
    method: 'DELETE'
  })
}

export function UpdateLongAndLat(data) {
  return request({
    url: '/Tenant/UpdateLongAndLat',
    method: 'get',
    data
  })
}
